import 'package:flutter/material.dart';

class Exam_13 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text("层叠布局Stack Positioned"),
      ),
      body: Content(),
    );
  }
}

class Content extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return ConstrainedBox(
      constraints: BoxConstraints.expand(),
      child: Stack(
        alignment: Alignment.center, //指定未定位或部分定位widget得对齐方式
        children: <Widget>[
          Container(
            child: Text(
              "Hello",
              style: TextStyle(color: Colors.white),
            ),
            color: Colors.redAccent,
          ),
          Positioned(
            child: Text("你好"),
            left: 20.0,
          ),
          
          Positioned(
            top: 20.0,
            child: Text("哈哈哈"),
          ),
        ],
      ),
    );
  }
}
